@extends('admin.base')

@section('content')
    <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
        <ul class="layui-tab-title">
            <li class="layui-this">网站配置</li>
            <li>APP配置</li>
        </ul>
        <div class="layui-card layui-tab-content">
            <div class="layui-card-body layui-tab-item layui-show">
                <form class="layui-form" action="{{route('admin.site.update')}}" method="post">
                    {{csrf_field()}}
                    {{method_field('put')}}

                    <input type="hidden" name="_type" value="base" />
                    <div class="layui-form-item">
                        <label for="" class="layui-form-label">站点标题</label>
                        <div class="layui-input-block">
                            <input type="text" name="title" value="{{ $base['title']??'' }}" lay-verify="required" placeholder="请输入标题" class="layui-input" >
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="" class="layui-form-label">站点关键词</label>
                        <div class="layui-input-block">
                            <input type="text" name="keywords" value="{{ $base['keywords']??'' }}" lay-verify="required" placeholder="请输入关键词" class="layui-input" >
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="" class="layui-form-label">站点描述</label>
                        <div class="layui-input-block">
                            <textarea class="layui-textarea" name="description" cols="30" rows="3" lay-verify="required">{{ $base['description']??'' }}</textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="" class="layui-form-label">CopyRight</label>
                        <div class="layui-input-block">
                            <input type="text" name="copyright" value="{{ $base['copyright']??'' }}" lay-verify="required" placeholder="请输入copyright" class="layui-input" >
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="" class="layui-form-label">电话</label>
                        <div class="layui-input-block">
                            <input type="text" name="phone" value="{{ $base['phone']??'' }}" lay-verify="required" placeholder="请输入电话" class="layui-input" >
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="" class="layui-form-label">城市</label>
                        <div class="layui-input-block">
                            <input type="text" name="city" value="{{ $base['city']??'' }}" lay-verify="required" placeholder="请输入城市" class="layui-input" >
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button type="submit" class="layui-btn" lay-submit="" lay-filter="formDemo">确 认</button>
                        </div>
                    </div>
                </form>
            </div>
            <div class="layui-card-body layui-tab-item">
                <form class="layui-form" action="{{route('admin.site.update')}}" method="post">
                        {{csrf_field()}}
                        {{method_field('put')}}

                        <input type="hidden" name="_type" value="app" />
                        <div class="layui-form-item">
                            <label for="" class="layui-form-label">APP版本号</label>
                            <div class="layui-input-block">
                                <input type="text" name="app_version" value="{{ $app['app_version']??'' }}" lay-verify="required" placeholder="请输入版本号" class="layui-input" >
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label for="" class="layui-form-label">可用版本号(每行一个)</label>
                            <div class="layui-input-block">
                                <textarea name="usable_version" placeholder="可用版本号，每行一个" class="layui-textarea">{{ $app['usable_version']??old('usable_version') }}</textarea>
                            </div>
                        </div>
                        @include('UEditor::head')
                        <div class="layui-form-item">
                            <label for="" class="layui-form-label">司机协议</label>
                            <div class="layui-input-block" >
                                <script name="driver_protocol" id="driver_container" type="text/plain">
                                    {!! $app['driver_protocol']??'' !!}
                                </script>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label for="" class="layui-form-label">货主协议</label>
                            <div class="layui-input-block">
                                <script name="owner_protocol" id="owner_container" type="text/plain">
                                    {!! $app['owner_protocol']??'' !!}
                                </script>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button type="submit" class="layui-btn" lay-submit="" lay-filter="formDemo">确 认</button>
                            </div>
                        </div>
                    </form>
            </div>
        </div>
    </div>
@endsection

@section('script')
    <!-- 实例化编辑器 -->
    <script type="text/javascript">
        var ue = UE.getEditor('driver_container');
        ue.ready(function () {
            ue.execCommand('serverparam', '_token', '{{ csrf_token() }}');//此处为支持laravel5 csrf ,根据实际情况修改,目的就是设置 _token 值.
        });

        var uee = UE.getEditor('owner_container');
        uee.ready(function () {
            uee.execCommand('serverparam', '_token', '{{ csrf_token() }}');//此处为支持laravel5 csrf ,根据实际情况修改,目的就是设置 _token 值.
        });
    </script>
@endsection()
